package com.ah.shanxi_demo.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zt 2020/8/21
 */
public enum SXPortEnum implements PolicyCommonInterface{

    //启用编码类型
    REGISTER("/nodes/register", "节点注册"),
    STATE_SYNC("/nodes/stateSync", "节点状态同步"),
    POLICY("/audits/policy", "策略生成"),
    DATE_REPORT("/audits/dateReport", "根据策略采集数据上传"),
    WORK_ORDERS("/workorders/get", "工单生成接口"),
    WORK_ORDERS_RECEIPT("/workorders/receipt", "工单回执接口"),
    ;

    private String key;
    private String value;

    final static Map<String, SXPortEnum> cachePort = new HashMap<>(values().length);

    static {
        for (SXPortEnum sxPortEnum : values()) {
            cachePort.put(sxPortEnum.key, sxPortEnum);
        }
    }

    SXPortEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static SXPortEnum convert(String key) {
        SXPortEnum type = cachePort.get(key);
        return type;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public Integer getKeyInt() {
        return Integer.parseInt(key);
    }
}
